package flc.ast.adapter;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.IdPhotosBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class IdPhotoAdapter extends StkProviderMultiAdapter<IdPhotosBean> {

    public IdPhotoAdapter() {
        addItemProvider(new StkSingleSpanProvider(126));
        addItemProvider(new IdPhotoProvider());
    }

    private class IdPhotoProvider extends BaseItemProvider<IdPhotosBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_id_photo;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, IdPhotosBean bean) {
            baseViewHolder.setText(R.id.tvIdPhotoItemName, bean.getName());
            baseViewHolder.setText(R.id.tvIdPhotoItemPx, bean.getPixelW() + "x" + bean.getPixelH() + getContext().getString(R.string.px_text));
            baseViewHolder.setText(R.id.tvIdPhotoItemMm, bean.getCyW() + "x" + bean.getCyH() + getContext().getString(R.string.mm_text));
            baseViewHolder.setText(R.id.tvIdPhotoItemDpi, bean.getRes() + getContext().getString(R.string.dpi_text));
        }
    }

}
